import axios from "axios";
const baseServe = vm.$myConfig.ip;
const baseServeOld = vm.$myConfig.baseIp;

function commonAjax(urls,type,data,callback,anync){
    let handleType="GET";
    if(type.toUpperCase()=="POST"){
        handleType="POST";
    }
    if(anync){
        anync=false;
    }else{
        anync=true;
    }
    vm.$vux.loading.show({
      text: 'Loading'
    })
    console.log("request==>"+`${urls}`)
    vm.$commonAjax(handleType,urls,data,callback,function(edata){
        console.log("返回失败！"+`${urls}`)
        console.log(edata)
        vm.promptDiagram.show=false;
      },function(comdata){
        vm.$vux.loading.hide()
        vm.promptDiagram.show=false;
      },anync)
}


//获取最新疫情的列表详情
export function queryNum(data,callback) {
  let url = `count`
  let urls = `${baseServe}${url}`;
  urls=urls;
  commonAjax(urls,"GET",data,callback);
}
//获取最新疫情的列表详情
export function queryNewList(data,callback) {
  let url = `article/list`
  let urls = `${baseServe}${url}`;
  urls=urls;
  commonAjax(urls,"GET",data,callback);
}

// home轮播
export function swiperAjaxData(data,callback) {
  let url = `app/find`
  let baseServes = `http://183.95.190.8:3645/`
  let urls = `${baseServes}${url}`;
  commonAjax(urls,"GET",{},callback);
}
//获取所有企业list
export function queryEnterpriseList(data,callback) {
  let url = `api/v1/enterprises/info/search`
  let baseServes = `http://116.62.205.14:30051/`
  let urls = `${baseServes}${url}`;
  commonAjax(urls,"POST",JSON.stringify(data),callback);
}

// -----------------lmc methods begin----------------------------------
//获取所有事件信息
export function queryEventList(data,callback) {
  let url = `mobile/getKeyword.mvc`
  let urls = `${baseServe}${url}`;
  commonAjax(urls,"GET",data,callback);
}
//添加现场反馈
export function feedbackSave(data,callback) {
  let url = `mobile/saveFeedBackForm.mvc`
  let urls = `${baseServe}${url}`;
  commonAjax(urls,"POST",data,callback);
}
//添加任务反馈
export function taskfeedbackSave(data,callback) {
  let url = `mobile/evntktaskback/save.mvc`
  let urls = `${baseServe}${url}`;
  commonAjax(urls,"POST",data,callback);
}
//添加需求物资
export function demandpresentationSave(data,callback) {
  let url = `mobile/demandpresentation/save.mvc`
  let urls = `${baseServe}${url}`;
  commonAjax(urls,"POST",data,callback);
}
//更新到达状态
export function updateArriveState(data,callback) {
  let url = `mobile/dispatchcase/update.mvc`
  let urls = `${baseServe}${url}`;
  commonAjax(urls,"POST",data,callback);
}



//------------------lmc methods end -----------------------------------

//基础数据级联菜单多级
export function queryCityData(data,callback) {

  let url = `api/dist/${data.parentCode}`
  // let baseServes = `http://39.105.209.108:8090/`
  // let urls = `${baseServes}${url}`;
  commonAjax(url,"GET",{},callback);
}
//基础数据级联菜单三级
export function queryCityDataForTwo(data,callback) {
  let url = `api/city/tree`
  // let baseServes = `http://39.105.209.108:8090/`
  // let urls = `${baseServes}${url}`;
  commonAjax(url,"GET",{},callback);
}

//医院医护人员上报页面
export function requestEnterpriseData(data, callback) {
      let url = `/api/enterprise/report`
  //     let baseServes = `http://39.105.209.108:8090/`
  //     let urls = `${baseServes}${url}`;
      commonAjax(url, "POST", JSON.stringify(data), callback);
  }
// 企业（实创）
  export function realGenData(data, callback) {
        let url = `/api/enterprise/report`
    //     let baseServes = `http://39.105.209.108:8090/`
    //     let urls = `${baseServes}${url}`;
        commonAjax(url, "POST", JSON.stringify(data), callback);
    }

// 任务清单列表
export function taskListAjaxData(data, callback) {
      let url = `/mobile/evntktask/list.mvc`
  //     let baseServes = `http://119.53.209.178:57010`
      let urls = `${baseServe}${url}`;
      commonAjax(urls, "GET",data, callback);
  }
// 任务详情
export function taskDetailsAjaxData(data, callback) {
      let url = `/mobile/evntktask/byid.mvc`
  //     let baseServes = `http://119.53.209.178:57010`
      let urls = `${baseServe}${url}`;
      commonAjax(urls, "GET",data, callback);
  }
  // 任务反馈列表
  export function taskFdAjaxData(data, callback) {
        let url = `/mobile/evntktaskback/list.mvc`
    //     let baseServes = `http://119.53.209.178:57010`
        let urls = `${baseServe}${url}`;
        commonAjax(urls, "GET",data, callback);
    }
    // 附件
    export function attachbyidAjaxData(data, callback) {
          let url = `/mobile/attachStream.mvc`
      //     let baseServes = `http://119.53.209.178:57010`
          let urls = `${baseServe}${url}`;
          commonAjax(urls, "GET",data, callback,true);
      }
    // 现场反馈列表
export function xcListData(data, callback) {
       let url = `mobile/feeback/list.mvc`
       //let baseServes = `http://119.53.209.178:57010/hg/`
       let urls = `${baseServe}${url}`;
      commonAjax(urls, "POST", data, callback);
  }
 //出动保存
  export function saveData(data, callback){
        let url = `mobile/dispatchcase/save`
        //let baseServes = `http://119.53.209.178:57010/hg/`
        let urls = `${baseServe}${url}`;
       commonAjax(urls, "POST", data, callback);
  }
  //获取职务
  export function getDataZW(data, callback){
        let url = `mobile/posttype/list`
      //  let baseServes = `http://119.53.209.178:57010/hg/`
        let urls = `${baseServe}${url}`;
       commonAjax(urls, "GET", data, callback,true);
  }

  //获取事件详情
  export function getDatafindEvent(data, callback){
        let url = `mobile/findEvent.mvc`
      //  let baseServes = `http://119.53.209.178:57010/hg/`
        let urls = `${baseServe}${url}`;
       commonAjax(urls, "GET", data, callback,true);
  }

  //获取携带装备
  export function getDataMaterial(data, callback){
        let url = ` mobile/material/list`
      //  let baseServes = `http://119.53.209.178:57010/hg/`
        let urls = `${baseServe}${url}`;
       commonAjax(urls, "GET", data, callback,true);
  }
  //查询当前队伍人员是否为队伍主导和出动情况的缓存回显
  export function getDataLeading(data, callback){
        let url = `mobile/dispatchcase/leading`
      //  let baseServes = `http://119.53.209.178:57010/hg/`
        let urls = `${baseServe}${url}`;
       commonAjax(urls, "GET", data, callback,true);
  }
  